package com.business.dynamic.controller;


import com.business.user.annotation.TokenPermission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.business.common.dto.R;
import com.business.dynamic.service.DynamicDefaultAttributeService;

/**
 * 动态默认属性表: 后端controller类
 *
 * @author chenjiehong
 * @date 2019-11-29 15:15:38
 * @since 1.0
 */
@RestController
@RequestMapping(value = "/defaultAttribute")
public class DynamicDefaultAttributeController {


    @Autowired
    private DynamicDefaultAttributeService dynamicDefaultAttributeServiceImpl;

    /**
     * 查询动态默认属性
     *
     * @param params
     * @date 2019-11-29 15:15:38
     */
    @PostMapping("/queryList")
    @ResponseBody
    @TokenPermission
    public R queryList(@RequestBody JSONObject params) {
        Integer type = params.getInteger("type");
        String parentCategoryCode = params.getString("parentCategoryCode");
        String subCategoryCode = params.getString("subCategoryCode");
        return R.success(dynamicDefaultAttributeServiceImpl.queryList(type, parentCategoryCode, subCategoryCode));
    }

}